import axios from "axios";

const myAxios = axios.create({
    baseURL: 'http://localhost:8080', timeout: 10000,
});
//请求拦截
myAxios.interceptors.request.use(function (config) {
    return config;
}, function (error) {
    return Promise.reject(error);
});

// 添加响应拦截器
myAxios.interceptors.response.use(function (response) {
    if (response.data.code !== 200) {
        return null;
    } else {
        return response.data;
    }

}, function (error) {
    return null;
});
export default myAxios
